<?php
 Include ("../../include/garennes.cfg") ;
 Include ("../../include/init.php") ;
 
 //$param_theme = parametres_theme (themeparsession ($_SESSION ["code"])) ;
 //$rep_themes = "../../images/themes/" ;
 //Include ($rep_themes.$param_theme ["nom_repertoire"]."/".$param_theme ["fichier_config"]) ;
 
 If (IsSet ($param))
  {
   If ($param == 1)
    {
     SQL_commande ("UPDATE utilisateurs SET theme='".$num_theme."' WHERE id_utilisateur='".utilparcode ($_SESSION ["code"])."'", $id_sql) ;
     SQL_commande ("UPDATE sessions SET theme='".$num_theme."' WHERE id_session='".$_SESSION ["code"]."'", $id_sql) ;
    }
  }

 Include ("../../images/themes/config.inc") ;
 $rep_themes = "../../images/themes/" ;

 Echo "<HTML>\n" ;
 Echo " <HEAD>\n" ;
 entete_html ("Garennes", "", 0) ;
 Echo styles ("none", "none", "none", $theme [0][32], "none") ;
 Echo " </HEAD>\n" ;
 
 Echo " <BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n" ;
 Echo "  <FORM ACTION=\"\">\n" ;

 Echo "  <TABLE BORDER=\"1\" ALIGN=\"CENTER\" CELLSPACING=\"5\" CELLPADDING=\"5\" STYLE=\"border-collapse:collapse;border:1px solid #000000\">\n" ;
 Echo "   <TR>\n" ;
 $num = themeparsession ($_SESSION ["code"]) ;
 If (!$num) { $num = 1 ; }
 For ($t = 1 ; $t <= $themes [0][0] ; $t++)
  {
   Include ($rep_themes.$themes [$t][1]."/".$themes [$t][2]) ;
   
   Echo "    <TD BACKGROUND=\"".$rep_themes.$themes [$t][1]."/".$theme [9][10]."\">\n" ;
   
   // MISE EN PLACE DU THEME
   Echo "  <TABLE BORDER=0 ALIGN=CENTER CELLSPACING=0 CELLPADDING=0>\n" ;
   Echo "   <TR>\n" ;
   Echo "    <TD STYLE=\"background-image: url(".$rep_themes.$themes [$t][1]."/".$theme [1][0].")\" BACKGROUND=\"".$rep_themes.$themes [$t][1]."/".$theme [1][0]."\"><IMG SRC=\"".$rep_themes.$themes [$t][1]."/".$theme [1][0]."\" BORDER=0></TD>\n" ;
   Echo "    <TD STYLE=\"background-image: url(".$rep_themes.$themes [$t][1]."/".$theme [2][0].")\" BACKGROUND=\"".$rep_themes.$themes [$t][1]."/".$theme [2][0]."\"" ;
   If ($theme [2][1] == 0) { Echo "<IMG SRC=\"".$rep_themes.$themes [$t][1]."/".$theme [2][0]."\" BORDER=0>" ; }
   Else
    {
     Switch ($theme [2][2])
      {
       Case  1 : Echo " ALIGN=\"CENTER\"" ; Break ;
       Case  2 : Echo " ALIGN=\"RIGHT\"" ; Break ;
       Default : Break ;
      }
     Echo "><FONT COLOR=\"".$theme [2][3]."\">Saisie&nbsp;de&nbsp;notes..." ;
    }
   Echo "</TD>\n" ;
   Echo "    <TD STYLE=\"background-image: url(".$rep_themes.$themes [$t][1]."/".$theme [3][0].")\" BACKGROUND=\"".$rep_themes.$themes [$t][1]."/".$theme [3][0]."\"><IMG SRC=\"".$rep_themes.$themes [$t][1]."/".$theme [3][0]."\" BORDER=0></TD>\n" ;
   Echo "   </TR>\n" ;
   Echo "   <TR>\n" ;
   Echo "    <TD STYLE=\"background-image: url(".$rep_themes.$themes [$t][1]."/".$theme [4][0].")\" BACKGROUND=\"".$rep_themes.$themes [$t][1]."/".$theme [4][0]."\"><IMG SRC=\"".$rep_themes.$themes [$t][1]."/".$theme [4][0]."\" BORDER=0></TD>\n" ;
   Echo "    <TD>\n ";
   
   Echo "        <TABLE BORDER=0 BGCOLOR=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"0\">\n" ;
   // ENTETES
   Echo "         <TR>\n" ;
   Echo "          <TD BGCOLOR=\"".$theme [0][9]."\" ROWSPAN=3 WIDTH=\"12\"></TD>\n" ;
   Echo "          <TD BGCOLOR=\"".$theme [0][9]."\" ROWSPAN=3 vALIGN=MIDDLE><FONT COLOR=\"".$theme [0][10]."\">&Eacute;l&egrave;ve</FONT></TD>\n" ;
   Echo "          <TD BGCOLOR=\"".$theme [0][11]."\" ALIGN=RIGHT><FONT SIZE=\"-3\" COLOR=\"".$theme [0][12]."\"><B>Date</B></FONT>&nbsp;</TD>\n" ;
   For ($i = 0 ; $i < 2 ; $i++)
    {
     Echo "          <TD COLSPAN=5 ALIGN=CENTER BGCOLOR=\"".$theme [11][$i % $theme [11][0]+1]."\"><FONT SIZE=\"-3\">&nbsp;" ;
     Echo Date ("j/m")."&nbsp;</B></FONT></TD>\n" ;
    }
   Echo "          <TD BGCOLOR=\"".$theme [0][17]."\" ROWSPAN=2 TITLE=\"Nouveau contr&ocirc;le\" ALIGN=CENTER vALIGN=MIDDLE>\n" ;
   Echo "           <H6>&nbsp;<FONT COLOR=\"".$theme [0][18]."\">Nouvelle&nbsp;note&nbsp;<BR>&nbsp;<FONT COLOR=\"#FF0000\"><B>".$code_absent."</B></FONT>&nbsp;=&nbsp;ABSENT&nbsp;<BR>&nbsp;<FONT COLOR=\"#FF0000\"><B>".$code_non_rendu."</B></FONT>&nbsp;=&nbsp;NON&nbsp;RENDU</FONT>&nbsp;</H6>\n" ;
   Echo "          </TD>\n" ;
   Echo "          <TD BGCOLOR=\"".$theme [0][19]."\" ROWSPAN=3 COLSPAN=5 TITLE=\"Moyenne Partielle\" vALIGN=MIDDLE ALIGN=CENTER><H6><FONT COLOR=\"".$theme [0][20]."\">Moy.</FONT></H6></TD>\n" ;
   Echo "         </TR>\n" ;
   // Ajouter une colonne par controle saisi
   Echo "         <TR>\n" ;
   Echo "          <TD BGCOLOR=\"".$theme [0][13]."\" ALIGN=RIGHT><FONT SIZE=\"-3\" COLOR=\"".$theme [0][14]."\"><B>Coeff.</B></FONT>&nbsp;</TD>\n" ;
   For ($i = 0; $i < 2 ; $i++)
    {
     Echo "          <TD COLSPAN=5 ALIGN=CENTER BGCOLOR=\"".$theme [11][$i % $theme [11][0]+1]."\"><FONT SIZE=\"-3\">" ;
     Echo "<B>&nbsp;1,0&nbsp;</B></FONT></TD>\n" ;
    }
   Echo "         </TR>\n" ;
   // Ajouter une action de suppression par controle saisi
   Echo "         <TR>\n" ;
   Echo "          <TD BGCOLOR=\"".$theme [0][15]."\" ALIGN=RIGHT><FONT SIZE=\"-3\" COLOR=\"".$theme [0][16]."\"><B>Action</B></FONT>&nbsp;</TD>\n" ;
   For ($i = 0 ; $i < 2 ; $i++)
    {
     Echo "          <TD COLSPAN=5 ALIGN=CENTER BGCOLOR=\"".$theme [11][$i % $theme [11][0]+1]."\"><FONT SIZE=\"-3\">&nbsp;" ;
     Echo "<B>&nbsp;Supp.&nbsp;</B>&nbsp;</FONT></TD>\n" ;
    }
   Echo "          <TD ALIGN=CENTER BGCOLOR=\"".$theme [0][9]."\"><FONT SIZE=\"-3\">&nbsp;" ;
   Echo "<B>Param&egrave;tres</B>&nbsp;</FONT></TD>\n" ;
   Echo "         </TR>\n" ;

   // Colonnes ELEVES
   Echo "         <TR BGCOLOR=\"".$theme [0][5]."\"><TD COLSPAN=\"19\"></TD></TR>\n" ;
   For ($j = 1 ; $j <= 2 ; $j++)
    {
     $couleur_nouv = $theme [10][$j % $theme [10][0]+1] ;
     // Icone d'acces a la fiche eleve
     Echo "         <TR BGCOLOR=\"".$couleur_nouv."\">\n" ;
     Echo "          <TD><IMG SRC=\"../../images/themes/".$themes [$t][1]."/".$theme [9][5]."\"" ;
     Echo " ALT=\"Acc&egrave; fiche &eacute;legrave;ve\" BORDER=0></TD>" ;
     // Colonne eleve
     Echo "          <TD COLSPAN=2><FONT SIZE=\"".$theme [0][28]."\">" ;
     Echo "&nbsp;DUPONT&nbsp;</FONT><FONT SIZE=\"-5\"><I>R&eacute;mi</I>&nbsp;</FONT>" ;
     Echo "</TD>\n" ;
   
     // Mise a zero du compteurs de colonne moyenne partielle
     // Colonnes des controles deja saisis [count ($c)]
     For ($i = 0 ; $i < 2 ; $i++)
      {
       If (($i % $theme [11][0] == 0) And ($j % $theme [10][0] == 0))
        {
         $couleur = $theme [11][$i % $theme [11][0]+1] ;
        }
       Else
        {
         $couleur = $theme [10][$j % $theme [10][0]+1] ;
        }
       affiche_note ($couleur, "Devoir", $theme [0][28], "12.3", 0, "") ;
      }
     // Colonne vide
     Echo "          <TD ALIGN=CENTER BGCOLOR=\"".$couleur_nouv."\">\n" ;
     Echo "           <FONT SIZE=\"".$theme [0][28]."\"><INPUT TYPE=\"TEXT\" NAME=\"a".$i."\" SIZE=7 MAXLENGT=5></FONT>\n" ;
     Echo "          </TD>\n" ;
     // Colonne moyenne partielle
     $moy = 12.3 ; // Round (Rand (0, 20), 2) ;
     $nom = "Moyenne trimestrielle pour DUPONT" ;
     If ($moy < 10)
      {
       affiche_note ($theme [10][$j % $theme [10][0]+1], $nom, $theme [0][28], "0".$moy, 1, "#FF0000") ;
      }
     Else
      {
       affiche_note ($theme [10][$j % $theme [10][0]+1], $nom, $theme [0][28], $moy, 0, "") ;
      }
     Echo "         </TR>\n" ;
    }
   
   // Ligne validation
   Echo "         <TR BGCOLOR=\"".$theme [0][3]."\">\n" ;
   Echo "          <TD COLSPAN=\"13\"></TD>\n" ;
   Echo "          <TD ALIGN=CENTER>\n" ;
   Echo "           <IMG SRC=\"../../images/themes/".$themes [$t][1]."/".$theme [9][0]."\" BORDER=0>\n" ;
   Echo "          </TD>\n" ;
   Echo "          <TD COLSPAN=\"5\"></TD>\n" ;
   Echo "         </TR>\n" ;
 
   // Trait de separation
   Echo "         <TR BGCOLOR=\"".$theme [0][6]."\"><TD COLSPAN=\"20\"></TD></TR>\n" ;
 
   // Ligne moyenne
   Echo "         <TR>\n" ;
   Echo "          <TD BGCOLOR=\"".$theme [0][21]."\" COLSPAN=3>&nbsp;<FONT COLOR=\"".$theme [0][22]."\">Moyenne&nbsp;Classe</FONT>&nbsp;&nbsp;</TD>\n" ;
   For ($i = 0 ; $i < 2 ; $i++)
    {
     affiche_note ($theme [11][$i % $theme [11][0]+1], "Moyenne : ", $theme [0][28], 12.3, 0, "") ;
    }
   Echo "          <TD BGCOLOR=\"".$theme [0][9]."\">&nbsp;</TD>\n" ;
   affiche_note ($theme [0][3], "Moyenne trimestrielle de la classe.", $theme [0][28], 12.3, 0, "") ;
   Echo "         </TR>\n" ;
 
   // Affichage de la ligne minimum
   Echo "         <TR BGCOLOR=\"".$theme [0][7]."\"><TD COLSPAN=\"20\"></TD></TR>\n" ;
   Echo "         <TR>\n" ;
   Echo "          <TD BGCOLOR=\"".$theme [0][23]."\" COLSPAN=3>&nbsp;<FONT COLOR=\"".$theme [0][24]."\">Note&nbsp;Minimum</FONT>&nbsp;&nbsp;</TD>\n" ;
   For ($i = 0 ; $i < 2 ; $i++)
    {
     affiche_note ($theme [11][$i % $theme [11][0]+1], "Note Minimum : ", $theme [0][28], 12.3, 0, "") ;
    }
   Echo "          <TD BGCOLOR=\"".$theme [0][9]."\">&nbsp;</TD>\n" ;
   affiche_note ($theme [0][3], "Moyenne Minimum de la classe.", $theme [0][28], 12.3, 0, "") ;
   Echo "         </TR>\n" ;
 
   Echo "         <TR BGCOLOR=\"".$theme [0][8]."\"><TD COLSPAN=\"20\"></TD></TR>\n" ;
 
   // Affichage de la ligne maximum
   Echo "         <TR>\n" ;
   Echo "          <TD BGCOLOR=\"".$theme [0][25]."\" COLSPAN=3>&nbsp;<FONT COLOR=\"".$theme [0][26]."\">Note&nbsp;Maximum</FONT>&nbsp;&nbsp;</TD>\n" ;
   For ($i = 0 ; $i < 2 ; $i++)
    {
     affiche_note ($theme [11][$i % $theme [11][0]+1], "Note Maximum : ", $theme [0][28], 12.3, 0, "") ;
    }
   Echo "          <TD BGCOLOR=\"".$theme [0][9]."\">&nbsp;</TD>\n" ;
   affiche_note ($theme [0][3], "Moyenne Maximum de la classe.", $theme [0][28], 12.3, 0, "") ;
   Echo "         </TR>\n" ;

   Echo "        </TABLE>\n" ;
   
   Echo "     </TD>\n" ;
   Echo "     <TD STYLE=\"background-image: url(".$rep_themes.$themes [$t][1]."/".$theme [5][0].")\" BACKGROUND=\"".$rep_themes.$themes [$t][1]."/".$theme [5][0]."\"><IMG SRC=\"".$rep_themes.$themes [$t][1]."/".$theme [5][0]."\" BORDER=0></TD>\n" ;
   Echo "    </TR>\n" ;
   Echo "    <TR>\n" ;
   Echo "     <TD STYLE=\"background-image: url(".$rep_themes.$themes [$t][1]."/".$theme [6][0].")\" BACKGROUND=\"".$rep_themes.$themes [$t][1]."/".$theme [6][0]."\"><IMG SRC=\"".$rep_themes.$themes [$t][1]."/".$theme [6][0]."\" BORDER=0></TD>\n" ;
   Echo "     <TD STYLE=\"background-image: url(".$rep_themes.$themes [$t][1]."/".$theme [7][0].")\" BACKGROUND=\"".$rep_themes.$themes [$t][1]."/".$theme [7][0]."\"><IMG SRC=\"".$rep_themes.$themes [$t][1]."/".$theme [7][0]."\" BORDER=0></TD>\n" ;
   Echo "     <TD STYLE=\"background-image: url(".$rep_themes.$themes [$t][1]."/".$theme [8][0].")\" BACKGROUND=\"".$rep_themes.$themes [$t][1]."/".$theme [8][0]."\"><IMG SRC=\"".$rep_themes.$themes [$t][1]."/".$theme [8][0]."\" BORDER=0></TD>\n" ;
   Echo "    </TR>\n" ;
   Echo "   </TABLE>\n" ;

   Echo "    </TD>\n" ;
   If ($t%2 == 0)
    {
     Echo "   </TR>\n" ;
     Echo "   <TR><TD COLSPAN=\"3\" HEIGHT=\"10\"></TD></TR>\n" ;
     Echo "   <TR>\n" ;
    }
   Else
    {
     Echo "   <TD WIDTH=\"5\"></TD>\n" ;
    }
  }
 Echo "   </TABLE>\n" ;
 //Echo "   <CENTER><INPUT TYPE=IMAGE SRC=\"../images/valider.png\" VALUE=\"  VALIDER  \" NAME=submit></CENTER>\n" ;
 Echo "  </FORM>\n" ;
 Echo " </BODY>\n" ;
 Echo "</HTML>\n" ;
?>